home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programmer Power Tools
/
Programmer Power Tools.iso
/
c
/
jazlib.arc
/
JZBACKGR.DMO
< prev
next >
Wrap
Text File
|
1986-07-20
|
3KB
|
128 lines
#define INC 3
#define TIMER 0x1c /* timer interrupt */
#define COPYWRITE "JZBACKGR (C) JazSoft 1986 by Jack A. Zucker @ 301-794-5950 |\
CIS: 75766,1336"
#define STATUSLINE " Press Esc to end program"
#define MAXNOTES 33 /* Number of notes in song */
#define cESC "\001"
#define ESCSCAN 1 /* scan code for escape code */
#include <jaz.h>
#include <keys.h>
#include <jzscreen.h>
int background(); /* play music in the background */
int jeopardy[] = /* Welcome to jeopardy with Art Flemming */
{
196,261,196,130,130,196,261,196,196,261,196,261,329,293,261,246,220,212,
196,261,196,130,130,196,261,196,261,220,196,174,164,146,130
};
int delay[] = { /* determines note value */
2,2,2,1,1,2,2,4,2,2,2,2,3,1,1,1,1,1,2,2,2,1,1,2,2,4,3,1,2,2,4,4,8
};
main()
{
TVECTOR wvec;
jzlogo();
jzgetint(TIMER,&wvec);
jzinsint(TIMER,background);
displayinfo();
getinfo();
soundoff();
jzsetint(TIMER,wvec);
}
#define FIRST 1
#define LAST 6
getinfo()
{
int w = 1,wch;
char name[31],street[31],city[16],state[3],zip[6],phone[13];
name[0] = 0;
street[0] = 0;
city[0] = 0;
state[0] = 0;
zip[0] = 0;
phone[0] = 0;
do {
switch(w) {
case 1 : wch = jzinstr(name,30,5,8,(CYAN << 4) + BLUE,60L,cESC);
break;
case 2 : wch = jzinstr(street,30,6,8,(CYAN << 4) + BLUE,60L,cESC);
break;
case 3 : wch = jzinstr(city,15,7,8,(CYAN << 4) + BLUE,60L,cESC);
break;
case 4 : wch = jzinstr(state,2,8,8,(CYAN << 4) + BLUE,60L,cESC);
break;
case 5 : wch = jzinstr(zip,5,9,8,(CYAN << 4) + BLUE,60L,cESC);
break;
case 6 : wch = jzinstr(phone,12,10,8,(CYAN << 4) + BLUE,60L,cESC);
break;
}
switch (wch) {
case CTRL_X :
case CTRL_M : w = min(LAST,w+1);
break;
case CTRL_E : w = max(FIRST,w-1);
break;
case PGDN : w = LAST;
break;
case PGUP : w = FIRST;
break;
case ESCSCAN: return;
}
} while (-1);
}
displayinfo()
{
int w;
cls(LIGHTGRAY);
jzscrprn(COPYWRITE,0,2,MAGENTA);
jzscrprn("Name :",5,0,YELLOW); jzdspfld("",30,5,8,(CYAN << 4) + BLUE);
jzscrprn("Street:",6,0,YELLOW); jzdspfld("",30,6,8,(CYAN << 4) + BLUE);
jzscrprn("City :",7,0,YELLOW); jzdspfld("",15,7,8,(CYAN << 4) + BLUE);
jzscrprn("State :",8,0,YELLOW); jzdspfld("",2,8,8,(CYAN << 4) + BLUE);
jzscrprn("Zip :",9,0,YELLOW); jzdspfld("",5,9,8,(CYAN << 4) + BLUE);
jzscrprn("Phone :",10,0,YELLOW); jzdspfld("",12,10,8,(CYAN << 4) + BLUE);
jzscrprn(STATUSLINE,24,2,GREEN);
}
background()
{
static int w=0,wcount=0;
if (w == MAXNOTES) w = 0;
if (wcount == 0) soundon(jeopardy[w]);
else {
if (wcount == (INC * delay[w])) {
soundoff();
wcount = -1;
w ++;
}
}
wcount ++;
}